﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Threading;
using SManage.TraceEngine;


namespace SManage.Core
{
    public class Initialization
    {
        private Boolean _finished;
        
        public static Boolean Initialized {
            get {
                String config = ConfigurationManager.AppSettings["Initialized"];
                return Boolean.Parse(ConfigurationManager.AppSettings["Initialized"]);
            }
        }

        public Boolean Finished {
            get {
                return _finished;
            }
        }

        public void Initialize(Action action) {
            SyncDispatcher.Finished += (o, e) => {
                action();
            };
            SyncDispatcher.Default();
            //ThreadPool.QueueUserWorkItem(_ =>
            //{
            //    Thread.Sleep(5000);
                
            //    action();
            //});
        }
    }   
}
